package com.dense.kuiniu.floatcabinet.mvp.ui.adapter;

import android.view.View;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.dense.kuiniu.floatcabinet.R;
import com.dense.kuiniu.floatcabinet.mvp.manager.bord.Door;
import com.dense.kuiniu.floatcabinet.mvp.ui.view.BoxItem;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/**
 * @author Administrator
 * @date 2020/9/29
 */
public class BoxForReaderAdapter extends BaseMultiItemQuickAdapter<Door, BaseViewHolder> {


    public BoxForReaderAdapter(@Nullable List<Door> data) {
        super(data);
        addItemType(1, R.layout.item_box);
        addItemType(2, R.layout.item_box_full);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, Door door) {
        if (door.getItemType() == 1) {
            BoxItem view = baseViewHolder.getView(R.id.view);
            view.setVisibility(door.isOpen() ? View.INVISIBLE : View.VISIBLE);
            view.setNumber(String.valueOf(door.getDoorNumber()));
        }
    }

}